home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 10393 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.0 KB

  1. Path: nntp.earthlink.net!pete-s-computer
  2. From: brunop@earthlink.net (Peter Bruno)
  3. Newsgroups: comp.lang.c++
  4. Subject: Help: File counting lines
  5. Date: Thu, 07 Mar 96 20:48:08 GMT
  6. Organization: Earthlink Network, Inc.
  7. Message-ID: <4hni12$qst@bolivia.it.earthlink.net>
  8. NNTP-Posting-Host: pool016.max12.new-york.ny.dynip.alter.net
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=US-ASCII
  11. Summary: Counting lines in ASCII file
  12. X-Newsreader: News Xpress 2.0 Beta #0
  13. Keyword: Help
  14.  
  15. Does anyone have any suggestions on a fast way to count the number of lines in 
  16. a ASCII file.  Each line is terminted by a <enter> and all I need to do is 
  17. count the number of lines (records) in the file.
  18.  
  19. The way I've been doing it is by:  fgets(row, 128, File); count++;
  20. however, if the line is longer then 128 characters this does not work and it 
  21. would seem that there must be a better way of doing it anyway... perhaps by 
  22. incrementing the pointer until EOF??
  23.  
  24. Any assistance would be greatly appreciated...
  25.  
  26. Thanx,
  27.  
  28. Peter Bruno
  29. brunop@earthlink.net
  30.